﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core
{
    public static partial class contest
    {
        public static dynamic getPNumber(int cid)
        {
            var sql = new Sql.SqlDataContext();
            if(sql.Contest.Where (row => row.cid == cid).FirstOrDefault() == null)
                return new{
                    success = false,
                    msg = "比赛不存在"
                };
            var pnumber = sql.ContestProblem.Count(row => row.cid == cid);
            return new
            {
                success = true,
                pnumber = pnumber
            };
        }
    }
}
